// page/member/code.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },
  onShow: function () {
    var app = getApp()
    var that = this;
    var uid = wx.getStorageSync('uid');
    // console.log(uid)
    wx.request({
      url: app.globalData.host + '&g=App&m=User&a=my_ewm',
      data: { uid: uid },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        console.log(res.data)
        that.setData({
          ewm: res.data.ewm
        })
      }
    }),
    wx.request({
      url: app.globalData.host + '&g=App&m=Index&a=feedback',
      data: {
        uid: uid,
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        console.log(res.data)
        var scene = res.data.scene
        that.setData({
          scene: res.data.scene
        })
      }
    })
  },

  // 分享
  onShareAppMessage: function (res) {
    var uid = wx.getStorageSync('uid');
    var that = this;
    var app = getApp()
    var scene = that.data.scene
    console.log(that.data.scene)
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '兴祥安驾校',
      path: 'page/member/code?scene=scene',
      success: function (res) {
        // 转发成功
        wx.request({
          url: app.globalData.host + '&g=App&m=Index&a=feedback',
          data: {
            scene: scene
          },
          header: {
            'content-type': 'application/json'
          },
        })
      },
      fail: function (res) {
        // 转发失败
      }
    }
  }
})